﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once
#include "GnufItem.h"
#include "GnufCheckControl.h"

namespace gnuf 
{
    class QtRadio;
    class GNUF_BASE_EXPORT Radio final
        : public ItemWith<QtRadio>
        , public CheckControlAdpatation
    {
        CANNOT_COPY_OR_ASSIGN(Radio);
    public:
        static const EItemType Type;
        explicit Radio(Item*);
        virtual ~Radio();

        void setIsChecked(bool checked, bool fromOutside = true);
        inline bool isChecked() const { return m_checked; }

    protected:
        // Inherits from ItemWith...
        virtual void onDisconnectFromMyQtItem() override;
        virtual void onPostAbilityChanged() override;
        virtual void onPostAppearanceSettingChanged() override;
        virtual void onTableRowSelectionChanged(bool) override;
        // Inherits from CheckControlAdpatation...
        virtual void onCheckStateChanged(bool) override;
        virtual void onAbilityChanged(bool) override;
        virtual void onCollectLocation(std::set<const gcmp::UniqueString *> &) const override;

    private:
        bool m_checked;
    };
}
